package com.supor.aiot.mine.api;

import com.android.baseconfig.base.BaseApiResult;
import com.android.baseconfig.base.BaseRetrofit;
import com.android.baseconfig.base.DataApiResult;
import com.supor.aiot.mine.bean.WishBean;

import java.util.List;

import io.reactivex.rxjava3.core.Observable;

/**
 * ---------------------------------------------------------------- <br>
 * Copyright (C) 2014-2020, by het, Shenzhen, All rights reserved.  <br>
 * ---------------------------------------------------------------- <br>
 * <p>
 * 描述: UserImpl <br>
 * 作者: lei <br>
 * 日期: 2020/11/7 <br>
 */
public class WishImpl extends BaseRetrofit<WishService> implements WishService {
    private static WishImpl instance;

    public static WishImpl getInstance() {
        if (instance == null) {
            instance = new WishImpl();
        }
        return instance;
    }

    /**
     * 2.3.1	新增心愿单接口
     *
     * @param wishBean wishBean
     * @return BaseApiResult<String>
     */
    public Observable<BaseApiResult<String>> addWish(WishBean wishBean) {
        return api.addWish(wishBean).compose(this.applySchedulers());
    }

    /**
     * 2.3.2	更新心愿单接口
     *
     * @param wishBean wishBean
     * @return BaseApiResult<String>
     */
    public Observable<BaseApiResult<String>> updateWish(WishBean wishBean) {
        return api.updateWish(wishBean).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<DataApiResult<List<WishBean>>>> getWishList(int page,
                                                                                int limit) {
        return api.getWishList(page, limit).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<String>> deleteWish(String wishId) {
        return api.deleteWish(wishId).compose(this.applySchedulers());
    }

}
